asm
  ld sp,$DFFF
  end asm

#include "./library/pacmandelay.bas"
'#include "./library/pingpongputsprite.bas"
#include "./library/smsrnd.bas"

dim eee as uinteger at $D210
dim seed as uinteger at $D212
dim ee2 as uinteger at $D214
dim ee3 as uinteger at $D216
dim ee4 as uinteger at $D218
dim eet as uinteger at $D21A
dim ex0 as uinteger at $D21C
dim ey0 as uinteger at $D21E

sub gberetputchar(txp1 as uinteger,typ1 as uinteger,tch1 as ubyte,tat1 as ubyte)
  poke $C800+typ1*64+txp1,tch1
  poke $C000+typ1*64+txp1,tat1
  end sub

seed=0


  for eee=0 to $7FF '- video ram, color ram
    seed=smsrnd(seed):ee2=seed:seed=smsrnd(seed)
    poke $C800+eee,seed
    poke $C000+eee,ee2
    poke $F600,0
    for ee2=0 to 100:next
    next

  for ey0=0 to 15
    for ex0=0 to 15
      gberetputchar(ex0+14,ey0+13,ey0*16+ex0,0)
      for ee2=0 to 200:next
      next:next


  for eee=$E000 to $E03F '- scroll
    seed=smsrnd(seed)
    poke eee,seed
    poke $F600,0
    for ee2=0 to 100:next
    next
  for eee=$E000 to $E03F '- scroll
    poke eee,0
    poke $F600,0
    for ee2=0 to 100:next
    next

ex0=8:ey0=8
eet=0
do
  gberetputchar(2,3,48+(int(eet/100) mod 10),0)
  gberetputchar(3,3,48+(int(eet/10) mod 10),0)
  gberetputchar(4,3,48+(eet mod 10),0)

  ee2=peek($F200) bxor 255
  gberetputchar(2,5,48+(int(ee2/100) mod 10),0)
  gberetputchar(3,5,48+(int(ee2/10) mod 10),0)
  gberetputchar(4,5,48+(ee2 mod 10),0)

  ee2=peek($F400) bxor 255
  gberetputchar(2,6,48+(int(ee2/100) mod 10),0)
  gberetputchar(3,6,48+(int(ee2/10) mod 10),0)
  gberetputchar(4,6,48+(ee2 mod 10),0)

  ee2=peek($F600) bxor 255
  gberetputchar(2,7,48+(int(ee2/100) mod 10),0)
  gberetputchar(3,7,48+(int(ee2/10) mod 10),0)
  gberetputchar(4,7,48+(ee2 mod 10),0)

  ee2=peek($F601) bxor 255
  gberetputchar(2,8,48+(int(ee2/100) mod 10),0)
  gberetputchar(3,8,48+(int(ee2/10) mod 10),0)
  gberetputchar(4,8,48+(ee2 mod 10),0)

  ee2=peek($F602) bxor 255
  gberetputchar(2,9,48+(int(ee2/100) mod 10),0)
  gberetputchar(3,9,48+(int(ee2/10) mod 10),0)
  gberetputchar(4,9,48+(ee2 mod 10),0)

  ex0=ex0+((ee2 band 2)/2)-((ee2 band 1)/1)
  ey0=ey0+((ee2 band 8)/8)-((ee2 band 4)/4)
  gberetputchar(ex0,ey0,eet,0)

  ee2=peek($F603) bxor 255
  gberetputchar(2,10,48+(int(ee2/100) mod 10),0)
  gberetputchar(3,10,48+(int(ee2/10) mod 10),0)
  gberetputchar(4,10,48+(ee2 mod 10),0)

  seed=smsrnd(seed)
  poke $D000+(eee band $1FF),seed
  poke $F600,0

  for ee2=0 to 100:next
  eet=eet+1
  loop

do:loop

'-------------------------------------


  for eee=$D000 to $D1FF '- sprites
    seed=smsrnd(seed)
    poke eee,seed
    poke $F600,0
    for ee2=0 to 100:next
    next


